package nero.yncc.com.createart.utils;

import android.app.Activity;

import java.util.HashMap;

import nero.yncc.com.createart.base.Constants;
import nero.yncc.com.createart.bean.UserBean;
import nero.yncc.com.createart.interfaces.InterfaceDoSomeThing;

/**
 * Created by nero on 2017/7/12.
 */


public class CollectionUtil {
    // : 获取收藏状态. : 执行收藏操作. :取消收藏操作
    public static final String get="GET_COLLECT_STATE",collection="DO_COLLECT",cancel="CANCEL_COLLECT";

    public static void collection(final Activity activity, String id, UserBean userBean, String action, final InterfaceDoSomeThing doSomeThing){

        HashMap<String,String> hashMap=new HashMap<>();
        hashMap.put("id",id);
        hashMap.put("user_id",userBean.getUser_id());
        hashMap.put("action",action);
        new HttpUtils().post(activity, Constants.API_COLLECTION_GOOD, hashMap, null, HttpUtils.TYPE_NOTHING, new HttpUtils.HttpCallback() {
            @Override
            public void success(String msg, Object json) {
                ToastUtil.showToast(activity,msg);
                doSomeThing.doSomething(json.toString());
            }

            @Override
            public void fail(String failMsg) {
                ToastUtil.showToast(activity,failMsg);
            }
        });

    }
}
